package cn.hinglo.gameclaw.admin.action;

import cn.hinglo.gameclaw.admin.service.MorderService;
import cn.hinglo.gameclaw.data.controller.BaseController;
import cn.hinglo.gameclaw.data.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @createTime: 2018/5/22
 * @author: HingLo
 * @description: 充值订单管理
 */
@RestController
@RequestMapping("/admin/mor/")
public class MorderAction extends BaseController {

    private final MorderService morderService;

    @Autowired
    public MorderAction(MorderService morderService) {
        this.morderService = morderService;
    }
    //***************************系统管理员管理订单信息******************************//

    /**
     * 查询指定时间的订单信息
     *
     * @param date 指定的时间
     * @return 返回订单列表
     */
    @GetMapping("list")
    public Result list(Integer type, @DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
        return morderService.listService(type, date);
    }

    /**
     * 充值统计
     *
     * @param start 开始时间
     * @param end   结束时间
     * @return 返回结果
     */
    @GetMapping("dataList")
    public Result dataList(@DateTimeFormat(pattern = "yyyy-MM-dd") Date start, @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
        return morderService.dataListService(start, end);
    }
}
